<div class="x_panel" >
    <div class="form-inline">
        <div class="form-group">
            <label>样式名称 </label>
            <input type="text" ng-model="dict.search.name"  class="form-control" />
        </div>
        <div class="form-group">
            <label>样式Id </label>
            <input type="number" ng-model="dict.search.code"  class="form-control" />
        </div>
        <button class="btn btn-primary" ng-click="find(1)" >查询</button>
        <button class="btn btn-default" ng-click="dict.search={}" >重置</button>
    </div>
</div>
<table class="table table-bordered table-striped table-hover scroll" style="margin-bottom: 0" >
    <thead class="title" >

    </thead>
    <tbody ng-class="{'showAll':dict.showAll}">
        <tr ng-repeat-start="style in dict.styles"></tr>
        <tr ng-class="{'mayHide':!style.data || style.data.length == 0}"><td colspan="100" style="padding: 0" class="panel-warning">
            <div style="margin-top: 10px;    border: 1px solid #faebcc;box-shadow: 0 1px 1px rgba(0,0,0,.05);border-bottom: none;" class="text-center panel-heading">
            <span th-check items="style.data" uib-tooltip="全选"class="pull-left" style="margin-left:28px;"></span>
                <style-type-edit style-type="dict" host="style"   field="'tagForModify'"><label uib-tooltip="tag-for-modify" class="btn-link" style="margin-left: 15px;">{{(style.text||style.name)+"_"+style.code}}:</label>{{style.tagForModify}}</style-type-edit>
                <i class="fa fa-fw fa-angle-up text" role="button" ng-click="style.showTitle=!style.showTitle" ng-class="{'text-active':style.showTitle,'fa-angle-up':style.showTitle,'fa-angle-down':!style.showTitle}" ></i>
                <span ng-if="$root.hasPower('style',curInstance.id)">
                <button class="btn btn-primary pull-right" ng-click="addRule(style)">添加</button>
                <button class="btn btn-info pull-right" ng-click="combineRules(dict,style)">合并或拆分</button>
                <button class="btn btn-success pull-right" ng-click="copyStyle(dict,style)">复制</button>
                </span>
            </div>
        </td></tr>
        <tr ng-if="style.showTitle">
            <th class="text-center">NO</th>
            <th  class="text-center" style="width:20px"><i role="button" uib-tooltip="取消选中" ng-click="unCheckAll(dict.ruleList)" class="text-danger glyphicon glyphicon-ban-circle text"></i></th>
            <th><span uib-tooltip="scale">级别</span></th>

            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'roofColor'"  ><span uib-tooltip="roof-color">楼顶颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'rootColor'"  ><span uib-tooltip="root-color">地面颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'wallColor'"  ><span uib-tooltip="wall-color">侧面颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'windowColor'"  ><span uib-tooltip="window-color">窗户颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'roofLineColor'"  ><span uib-tooltip="roof-line-color">楼顶边颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'wallLineColor'"  ><span uib-tooltip="wall-line-color">侧面边颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'number'" field="'diffuse'"  ><span uib-tooltip="diffuse">diffuse</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'arrayDict'" array-dict="$root.lightSourceDict" field="'lightSource'"  ><span uib-tooltip="light-source">光源位置</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'icon'" field="'roofTexture'"  ><span uib-tooltip="roof-texture">楼顶纹理</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'icon'" field="'wallTexture'"  ><span uib-tooltip="wall-texture">侧面纹理</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'arrayDict'" array-dict="$root.yesNoDict" field="'windowRepeat'"  ><span uib-tooltip="window-repeat">重复描绘窗户</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'roofLineColor2d'"  ><span uib-tooltip="roof-line-color-2d">2D模式楼顶边颜色</span></group-edit></th>
            <th><group-edit style-type="dict" host="style"  field-type="'color'" field="'roofColor2d'"  ><span uib-tooltip="roof-color-2d">2D模式楼顶颜色</span></group-edit></th>


            <th style="width:120px" ng-if="$root.hasPower('style',curInstance.id)">操作</th>
        </tr>
        <tr ng-class="{'mayHide':!style.data || style.data.length == 0}" ng-if="!style.data || style.data.length == 0">
            <td colspan="100" class="text-center">暂无记录</td>
        </tr>

        <tr ng-repeat-start="item in style.data" ng-if="!item.edit" ng-class="{'bg-success': item.checked}">
            <td class="text-center">{{$index + 1}}</td>
            <td td-check item="item"></td>
            <td>{{item.scale}}</td>

            <td color-trans color-id="item.roofColor" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.rootColor" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.wallColor" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.windowColor" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.roofLineColor" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.wallLineColor" instance='curInstance' element-id="dict.id"></td>
            <td>{{item.diffuse}}</td>
            <td>{{item.lightSource|keyToValue:$root.lightSourceDict}}</td>
            <td><div lazy-src="{{item.roofTexture}}" /></td>
            <td><div lazy-src="{{item.wallTexture}}" /></td>

            <td>{{item.windowRepeat|keyToValue:$root.yesNoDict}}</td>
            <td color-trans color-id="item.roofLineColor2d" instance='curInstance' element-id="dict.id"></td>
            <td color-trans color-id="item.roofColor2d" instance='curInstance' element-id="dict.id"></td>

            <td ng-if="$root.hasPower('style',curInstance.id)">
                <ng-include src="'view/instance/style_edit_buttons.html'"></ng-include>
            </td>
        </tr>
        <tr ng-repeat-end ng-if="item.edit" ng-form name="form" novalidate>
            <td class="text-center">{{$index + 1}}</td>
            <td td-check item="item"></td>
            <td>
                <input type="text" class="form-control" ng-model="item.copy.scale" ng-pattern="/^[\d]+,[\d]+$/i"
                       required>
            </td>
            <td>
                <color-selector host="item.copy" key="'roofColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'rootColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'wallColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'windowColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'roofLineColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'wallLineColor'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td><input type="number" class="form-control" ng-model="item.copy.diffuse" required></td>

            <td><select class="form-control" ng-model="item.copy.lightSource" required
                        ng-options="o[0] as o[1] for o in $root.lightSourceDict">
                <option value="">--请选择--</option>
            </select>
            </td>
            <td> <icon-edit host="item.copy" key="'roofTexture'" ></icon-edit> </td>
            <td> <icon-edit host="item.copy" key="'wallTexture'" ></icon-edit> </td>
            <td><select class="form-control" ng-model="item.copy.windowRepeat" required
                        ng-options="o[0] as o[1] for o in $root.yesNoDict">
                <option value="">--请选择--</option>
            </select>
            </td>
            <td>
                <color-selector host="item.copy" key="'roofLineColor2d'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <color-selector host="item.copy" key="'roofColor2d'" instance='curInstance'
                                element-id="dict.id"></color-selector>
            </td>
            <td>
                <a href='javascript:void(0)' ng-click="saveRule(form,item,'../rule/saveRuleBuilding',style)"
                   class='btn btn-xs btn-link text-primary'><span class='fa fa-save'></span>保存</a>
                <a href='javascript:void(0)' ng-click="cancelRule(style,item)"
                   class='btn btn-xs btn-link text-danger'><span class='fa fa-undo'></span>取消</a>
            </td>
        </tr>
        <tr ng-repeat-end ng-if="false"></tr>
    </tbody>

</table>
<div class="clearfix" >
    <page  page-model="dict.pageModel"></page>
</div>